# geometry.two_d.base -- Module for point geometry
#
# Copyright (c) 2000, V.Kelson and M.Bakker
#

import geometry.xy
XY = geometry.xy.XY
import base
import circle
import rectangle

class Point(geometry.xy.XY,base.Geometry2d):
	'''Class for 2D point geometries'''
	def __init__(self,x=0.0,y=0.0):
		'''Constructor; takes x,y

		Constructor for Point class. Syntax: Point(x,y)'''
		geometry.XY.__init__(self,x,y)
	def __repr__(self):
		'''Representation method'''
		return 'Point' + repr((self.x,self.y))
	def __str__(self):
		'''Returns printable string representation of the object'''
		return "[Point at " + str((self.x,self.y)) + ']'
	def isOnBoundary(self,pt,tol=0.0):
		return self.distance2(pt) < tol * tol
	def circumCircle(self,tol=0.0):
		return circle.Circle(self.x,self.y,tol)
	def map(self,pt):
		return [ (pt - self.zc).complex() ]
	def bbox(self,tol=0.0):
		space = geometry.XY(float(tol),float(tol))
		return rectangle.Rectangle(self-space,self+space)


